Updates a user in the database.
the updated user entity if the update was successful, otherwise null
the user entity to be updated